<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
Object obj=request.getSession().getAttribute("role_resource");
if(null==obj){
	response.setStatus(1000);
	return;
}
%> 
<script type="text/javascript">
	var dep_add_update = 0;
	
	var store = new Ext.data.JsonStore({
		root:"data",
    	totalProperty: "total",
		fields: ["id","name","remark"],
		url: "depart!listByOrg.action"
	});
	
	var dep_panel = {
		id: "dep_panel",
		xtype: "grid",
		region:"center",
		stripeRows:true,
		loadMask : true,//在加载数据时遮罩住元素,替换元素Updater的加载提示器，并且在初始化加载之后销毁
		autoExpandColumn:"remark",//自动填充
		autoExpandMin : 100,//自动填充最小宽度
		store: store,
		headersDisabled: true,
		columns:[
        	new Ext.grid.RowNumberer({header: "序号", width:35}),
        	{header: "部门编号", dataIndex: "id", menuDisabled: true},
        	{header: "部门名称", dataIndex: "name", menuDisabled: true},
			{header: "备注", dataIndex: "remark",id:"remark", menuDisabled: true}
		],
		bbar: new Ext.ux.PagingToolbar({
			id:"depart_paging",
        	pageSize:limit,
        	store: store
    	})
	};
	
	var depart_pel = new Ext.Panel({
		id:"master_panel",
		border : false,
		layout: "border",
		items: [{
				id:"orgTree",
				xtype: "billTreePanel",
				dataUrl: "tree!organization.action",
				root: new Ext.tree.AsyncTreeNode({
					id: "root",
					expanded : true
				}),
				listeners: {
					"click": function(node){
						if (!node.id == "0"){
							store.baseParams = store.baseParams || {};
							store.baseParams["oid"] = node.id;
							store.load({params:{start : 0,limit :limit}});
						}
					}
				}
			}, dep_panel]
	});	

	var CenterPanel=Ext.getCmp("CenterPanel");
	CenterPanel.removeAll();
	CenterPanel.add(depart_pel);
	CenterPanel.doLayout();
</script>